import os
import sys
import argparse

# 导入必要的函数
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
sys.path.insert(0, parent_path)
from base import train
from dataset_utils import load_dataset_cfgs

# 定义训练主函数
def main():
    parser = argparse.ArgumentParser(description='Train yolov3 detector')
    parser.add_argument('config', help='train config file path')
    args = parser.parse_args()

    base_cfg_path = os.path.join( parent_path, 'configs/yolov3/yolov3_mobilenet_v1_roadsign.yml' )
    num_classes, user_cfg_dict = load_dataset_cfgs( args.config )
    train( base_cfg_path, user_cfg_dict, 'output/yolov3_mobilenet_v1_270e/models' )

main()